package location;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "LocationServlet", urlPatterns = {"/location"})
public class LocationServlet extends HttpServlet {

  protected void doGet(HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {
    // 重定向 (response)
//    response.setStatus(302);
//    response.setHeader("location", "http://www.baidu.com");
    // response.sendRedirect("/requestEncode?name=zhhh");
    // 请求转发
    request.getRequestDispatcher("/requestEncode").forward(request, response);
  }
}








